# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

data = open("buffer_sizes.txt", "r")
lines = data.readlines()
data.close()

x = []
y = []
xall = []
yall = []
i = 0
tmp_x = []
tmp_y = []
for line in lines:
  tokens = line.split()
  tmp_x.append(int(tokens[1]))
  tmp_y.append(int(tokens[0]))
  xall.append(int(tokens[1]))
  yall.append(int(tokens[0]))
  i += 1
  if i == 9:
    x.append(sum(tmp_x)/float(len(tmp_x)))
    y.append(sum(tmp_y)/float(len(tmp_y)))
    i = 0
    tmp_x = []
    tmp_y = []
ax.plot(xall, yall, 'o',alpha=0.5,ms=3.0,color='green')
ax.plot(x,y,color='blue',lw=2.0)
plt.show()
